package com.dfrz.ch08;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
/**
 * 作者：wangmaokang
 * 日期: 2021/4/16 11:22
 * 描述:
 */
public class AddOperationTest {
    @After
    public void after(){   //运行单元测试函数(方法)执行之后
        System.out.println("我是后面执行的");
    }
    @Before
    public void before(){  //单元测试函数（方法）执行之前
        System.out.println("我是要提前执行的");
    }
    @Test(timeout =3000)  //验证方法的执行时间
    public void add(){
        AddOperation addOperation=new AddOperation();
        Integer integer=  addOperation.add(2,0);
    }
    @Test(expected = ArithmeticException.class)    //检查异常这个方法 有 ArithmeticException 异常
    public void  divide(){
        AddOperation addOperation=new AddOperation();
         Integer integer=  addOperation.divide(2,0);
    }
    @Ignore  //忽略
    @Test
    public void subtract(){
        AddOperation addOperation=new AddOperation();
        Integer integer=  addOperation.subtract(2,0);
    }
}
